//
//  EnterDataCell.m
//  Zyachting
//
//  Created by NGUYEN THE HUNG on 11/6/12.
//
//

#import "TextViewCell.h"
#import <QuartzCore/QuartzCore.h>

@implementation TextViewCell
@synthesize textView;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        //The rounded corner part, where you specify your view's corner radius:
        //textView.layer.cornerRadius = 5;
        //textView.clipsToBounds = YES;
        textView.backgroundColor = [UIColor clearColor];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)textViewDidEndEditing:(UITextView *)_textView
{
    NSLog(@"end edit");
}
- (BOOL)textViewShouldEndEditing:(UITextView *)_textView
{
    return YES;
}
- (BOOL)textView:(UITextView *)_textView shouldChangeTextInRange:(NSRange)range
 replacementText:(NSString *)text
{
    // Any new character added is passed in as the "text" parameter
    if ([text isEqualToString:@"\n"]) {
        // Be sure to test for equality using the "isEqualToString" message
        [_textView resignFirstResponder];
        
        // Return FALSE so that the final '\n' character doesn't get added
        return FALSE;
    }
    // For any other character return TRUE so that the text gets added to the view
    return TRUE;
}
@end
